package com.example.uniappspringbootstartweb.mapper;

import com.example.uniappspringbootstartweb.entity.Content;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;
@Repository
public interface ContentRepository extends JpaRepository<Content, Long> {

    List<Content> findByTab(String tab);


    Optional<Content> findByIdAndTab(Long id, String tab);

    @Query("SELECT c FROM Content c WHERE LOWER(c.title) LIKE %:query%")
    List<Content> findByTitleContainingIgnoreCase(@Param("query") String query);
}



